<template>
    <el-scrollbar height="600px">
   <el-card style="max-width: 100%">
     <el-form
      :model="userDetail" 
      label-width="auto"
      style="max-width: 600px"
     >
         <el-form-item label="ID" >
            <el-input v-model="userDetail.id" readonly/>
         </el-form-item>
         <el-form-item label="账号" >
            <el-input v-model="userDetail.loginAct" readonly/>
         </el-form-item>
         <el-form-item label="姓名" >
            <el-input v-model="userDetail.name" readonly/>
         </el-form-item>
         <el-form-item label="手机号" >
            <el-input v-model="userDetail.phone" readonly/>
         </el-form-item>
         <el-form-item label="邮箱" >
            <el-input v-model="userDetail.email" readonly/>
         </el-form-item>
         <el-form-item label="账号未过期" >
            <el-input v-model="userDetail.accountNoExpired" readonly></el-input>
         </el-form-item>
         <el-form-item label="账号未锁定" >
            <el-input v-model="userDetail.accountNoLocked" readonly/>
         </el-form-item>
         <el-form-item label="账号是否启用" >
            <el-input v-model="userDetail.accountEnabled" readonly/>
         </el-form-item>
         <el-form-item label="创建时间" >
            <el-input v-model="userDetail.createTime" readonly/>
         </el-form-item>

         <el-form-item label="创建人" >
            <el-input v-model="userDetail.createBy" readonly/>
         </el-form-item>
         <el-form-item label="编辑时间" >
            <el-input v-model="userDetail.editTime" readonly/>
         </el-form-item>
         <el-form-item label="编辑人" >
            <el-input v-model="userDetail.editBy" readonly/>
         </el-form-item>
         <el-form-item label="最近登陆时间" >
            <el-input v-model="userDetail.lastLoginTime" readonly/>
         </el-form-item>
     </el-form>
     <el-button type="primary" style="margin-left: 100px;" @click="router.go(-1)">返回</el-button>
   </el-card>
</el-scrollbar>
 </template>
 
 
<script lang="ts" setup name="">
import { baseService } from '@/utils/httpReqest';
import { ElMessage } from 'element-plus';
import { onMounted, reactive } from 'vue';
import { useRoute } from 'vue-router';
import router from '@/router';
import User from '@/hooks/user';
let route = useRoute();
let userDetail = reactive(new User());
onMounted(() => {
   console.log(route.params.id);
   baseService.doGet(`/user/detail/${route.params.id}`)
      .then((res: any) => {
         if (res.code == 200) {
            console.log(res.data);
            for (const key in userDetail) {
               userDetail[key as keyof User] = res.data[key]
            }
            console.log(userDetail);
         } else {
            ElMessage.error("该用户信息不存在")
         }
      })
})
</script>
<style scoped>
</style>